package com.tong.hao.ac.api.model.in.finance;

import cn.buddha.jec.constants.TongConstant;
import cn.buddha.jec.model.TongBaseRequest;
import cn.buddha.jec.util.TongDateUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tong.hao.ac.api.validation.constraints.AcAccountClassCheck;
import com.tong.hao.ac.api.validation.constraints.AcBillCategoryCheck;
import com.tong.hao.ac.api.validation.constraints.AcBillClassCheck;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @ClassName AC010001Req
 * @Author 友野浩二
 * @Date 2020/4/23 17:53
 * @Description 记录账单请求DTO
 * @Version 1.0
 */
@Setter
@Getter
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
public class AC010001Req extends TongBaseRequest {
    private static final long serialVersionUID = 8657504338215381804L;

    @ApiModelProperty(value = "用户编号", required = true)
    @NotBlank
    private String userKey;

    /**
     * 入参格式化: 传入的参数 reqTranDate 是 String ,而接收参数的 reqTranDate 是 java.util.Date 类型的，类型无法直接转换，需要使用@DateTimeFormat
     */
    @ApiModelProperty(value = "账单日期", required = true, example = "yyyy-MM-dd", position = 1)
    @NotNull
    @JsonFormat(timezone = TongConstant.TIME_ZONE_GMT8, pattern = TongDateUtils.PATTERN_ISO_DATE)
    private Date acDate;

    @ApiModelProperty(value = "账单类别编号(参见ac_bill_class.bill_id)", required = true, position = 2)
    @AcBillClassCheck
    private String billClassId;

    @ApiModelProperty(value = "账单类型编号(参见ac_bill_category.bill_id)", required = true, position = 3)
    @AcBillCategoryCheck
    private String billCategoryId;

    @ApiModelProperty(value = "转入账户类型编号(参见ac_account_class.account_id)", required = true, position = 4)
    @AcAccountClassCheck
    private String accountInId;

    @ApiModelProperty(value = "转出账户类型编号(参见ac_account_class.account_id)", required = true, position = 5)
    private String accountOutId;

    @ApiModelProperty(value = "账单金额(最小单位是分)", required = true, position = 6)
    @Min(value = 0)
    private BigDecimal acAmount;

}
